package STUDENT.TranNamAnh.OOPs.baitap2;


public class Controllers {
	private String result;

	public String getResult() {
		return result;
	}

	public void setResult(String result) {
		this.result = result;
	}
	
	Models objMod = new Models();
	
	public void kiemTraPhepTinh(Object obj){
		switch (obj.getStrPhepToan()){
		case "+":
			result = "" + objMod.cong(obj);
			break;
		
		case "-":
			result = "" + objMod.tru(obj);
			break;
		case ":":
			if(obj.getA() == 0 && obj.getB() == 0)
				result = "Khong the tinh duoc";
			else if(obj.getB() == 0)
				result = "Khong the chia 1 so cho 0";
			else
				result = "" + objMod.chia(obj);
			break;
		case "x":
			result = "" + objMod.nhan(obj);
			break;
		default:
			System.out.println("Co loi xay ra!!!!!!");
			break;
			
		}
	}

}

